package 进阶.转换流.字符编码和字符集;

import java.io.*;

public class demo03_Test {
    public static void main(String[] args) throws IOException {
        Write();
        Read();

    }

    private static void Write() throws IOException {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream("d:/a.txt"), "gbk");

        outputStreamWriter.write("爪洼");

        outputStreamWriter.close();
    }

    private static void Read() throws IOException {
        InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream("d:/a.txt"), "gbk");

        int s = inputStreamReader.read();
        System.out.println((char) s);

        inputStreamReader.close();
    }

}
